<!-- 角色表单 menuForm.jsp -->
<%@ page contentType="text/html; charset=UTF-8"%>
<%@page import="frm.ssh.util.page.SearchBean"%>
<%@ include file="/jsp/common/common.jsp"%>

<%
	String[] colcodeArray = (String[]) request.getAttribute("colcodeArray");
	String[] colnameArray = (String[]) request.getAttribute("colnameArray");
	String[] colcheckArray = (String[]) request.getAttribute("colcheckArray");
%>
<html>
	<head>
		<script language="javascript" src="<%=contextPath%>/js/func.js"type=""></script>
		<script>
		
			Ext.onReady(function(){
				var tb = new Ext.Toolbar({
			   		renderTo: document.all.tbar,
			    	items: [
				        {
				            text: '保存',
				            icon:"<%=contextPath%>/images/save.gif",
				            handler:save
				       },'-',
				       {
				            text: '全选',
				            icon:"<%=contextPath%>/images/checkboxchecked.gif",
				            handler:function() {
				           		checkAll2(document.getElementById("frmM"), 'saveArray');
				            }
					   },'-',
				       {
				            text: '全部取消',
				            icon:"<%=contextPath%>/images/checkbox.gif",
				            handler:function() {
				            	uncheckAll2(document.getElementById("frmM"), 'saveArray');
				            }
 					   }
			    	]
			    });
			});
		</script>
	</head>
	<body>
		<div id ='tbar'></div>
		<br>
		<form id="frmM" name="frmM" method="POST" >
		
			<table width="100%" id="contab">
				<tr>
					<th width="200">角色</th>
					<td >
						<s:select list="roleList" onChange="javascript:cmt()" emptyOption="true" datatype="Require" name="roleid" width="300" listKey="id" listValue="name" msg="角色必须选择。"/>
					</td>
				</tr>
				<tr>
					<td colspan="2"><span><center>
						<c:if test="${searchBean.con1 == 'ROLE_FROM'}"> 
							告知书信息
						</c:if>
						<c:if test="${searchBean.con1 == 'SEROLE_FROM'}"> 
							首检设备信息
						</c:if>
					</center></span></td>
				</tr>
			</table>
			<table width="100%" id="contab">
				<tbody id="querydiv">
					<%
						for (int i=0; i< colcodeArray.length; i++ ) {
							if (i%3 == 0) { 
					%>
								<tr>
					<%		}%>

								<th width="25">
									<%=colnameArray[i]%>
								</th>
								<td>
									<input type="checkbox" name="saveArray" value= "<%=colcodeArray[i]%>" <%=colcheckArray[i]%> />
								</td>
								<th width="25" >
									<% if ("".equals(colnameArray[++i])) {%>
										&nbsp;
									<% } else {%>
										<%=colnameArray[i]%>
									<%}%>
								</th>
								<td>
									<% if ("".equals(colcodeArray[i])) {%>
										&nbsp;
									<% } else {%>
										<input type="checkbox" name="saveArray" value= "<%=colcodeArray[i]%>" <%=colcheckArray[i]%>/>
									<%}%>
								</td>
								<th width="25" >
									<% if ("".equals(colnameArray[++i])) {%>
										&nbsp;
									<% } else {%>
										<%=colnameArray[i]%>
									<%}%>
								</th>
								<td>
									<% if ("".equals(colcodeArray[i])) {%>
										&nbsp;
									<% } else {%>
										<input type="checkbox" name="saveArray" value= "<%=colcodeArray[i]%>" <%=colcheckArray[i]%>/>
									<%}%>
								</td>

							<%   if (i%3 == 2) { %>
									</tr>
							<%		
								}
						} 
					%>

				</tbody>
			</table>
		</form>
	</body>
</html>
<script language="javascript">

			// 查询
			function cmt(){
				document.frmM.action = "<%=contextPath%>/roleForm!initDetail.do";
				document.frmM.submit();
			}
			
			// 保存
			function save(){
				if (document.getElementById("roleid").value == "") {
					alert("请先选择角色");
					return;
				}
				document.frmM.action = "<%=contextPath%>/roleForm!save.do";
				document.frmM.submit();
			}

		</script>